package com.xjrsoft.module.customerTwo.barin.t_barin_srerp_report.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.xjrsoft.core.tool.utils.StringUtil;
import com.xjrsoft.module.customerTwo.barin.t_barin_srerp_report.entity.TBarinSrerpReport;
import com.xjrsoft.module.customerTwo.barin.t_barin_srerp_report.dto.TBarinSrerpReportListDto;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.page.PageOutput;
import java.util.List;
import com.xjrsoft.module.customerTwo.barin.t_barin_srerp_report.mapper.TBarinSrerpReportMapper;
import com.xjrsoft.module.customerTwo.barin.t_barin_srerp_report.service.ITBarinSrerpReportService;
import com.xjrsoft.core.mp.base.BaseService;
import com.xjrsoft.core.tool.utils.Func;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;

/**
 *  服务实现类
 *
 * @author dongxinhang
 * @since 2024-06-18
 */
@Service
@AllArgsConstructor
public class TBarinSrerpReportServiceImpl extends BaseService<TBarinSrerpReportMapper, TBarinSrerpReport> implements ITBarinSrerpReportService {


	@Override
	public IPage<TBarinSrerpReport> getPageList(TBarinSrerpReportListDto pageListDto) {
		Wrapper<TBarinSrerpReport> wrapper = Wrappers.<TBarinSrerpReport>query().lambda()
				.like(!StringUtil.isEmpty(pageListDto.getF_FirmName()), TBarinSrerpReport::getFFirmname, pageListDto.getF_FirmName())
				.eq(!StringUtil.isEmpty(pageListDto.getF_BomNumber()), TBarinSrerpReport::getFBomnumber, pageListDto.getF_BomNumber())
				.eq(!StringUtil.isEmpty(pageListDto.getF_SeOrderNum()), TBarinSrerpReport::getFSeordernum, pageListDto.getF_SeOrderNum())
				.eq(!StringUtil.isEmpty(pageListDto.getF_PpOrderNum()), TBarinSrerpReport::getFPpordernum, pageListDto.getF_PpOrderNum())
				.eq(!StringUtil.isEmpty(pageListDto.getF_IcmoNum()), TBarinSrerpReport::getFIcmonum, pageListDto.getF_IcmoNum())
				.eq(!StringUtil.isEmpty(pageListDto.getF_IcStockBillNum()), TBarinSrerpReport::getFIcstockbillnum, pageListDto.getF_IcStockBillNum());
		return this.page(ConventPage.getPage(pageListDto), wrapper);
	}

	@Override
	public boolean addTBarinSrerpReport(TBarinSrerpReport tBarinSrerpReport) {
		boolean isSuccess = this.save(tBarinSrerpReport);
		return isSuccess;
	}

	@Override
	public boolean updateTBarinSrerpReport(String id, TBarinSrerpReport tBarinSrerpReport) {
		tBarinSrerpReport.setFId(id);
		return this.updateById(tBarinSrerpReport);
	}

	public boolean delete(String ids) {
		List<String> idList = Func.toStrList(ids);
		if (this.removeByIds(idList)) {
			return true;
		}
		return false;
	}

}